/* Copyright (C) 2010-2011, Mamadou Diop.
*  Copyright (C) 2011, Doubango Telecom.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango(dot)org>
*	
* This file is part of imsdroid Project (http://code.google.com/p/imsdroid)
*
* imsdroid is free software: you can redistribute it and/or modify it under the terms of 
* the GNU General Public License as published by the Free Software Foundation, either version 3 
* of the License, or (at your option) any later version.
*	
* imsdroid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
* See the GNU General Public License for more details.
*	
* You should have received a copy of the GNU General Public License along 
* with this program; if not, write to the Free Software Foundation, Inc., 
* 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package org.doubango.imsdroid.Screens;

import org.doubango.imsdroid.Login.LoginActivity;
import org.doubango.imsdroid.Login.SoftBindActivity;
import org.doubango.imsdroid.R;
import org.doubango.ngn.NgnEngine;
import org.doubango.ngn.services.INgnSipService;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class ScreenSettings extends BaseScreen {

    private static String TAG = ScreenSettings.class.getCanonicalName();

    private final NgnEngine mEngine;
//	private final INgnConfigurationService mConfigurationService;

//	private final static String SIP_DOMAIN = "59.110.217.175:9170";
//	private final static String SIP_USERNAME = "18613613612";
//	private final static String SIP_PASSWORD = "654321";
//	private final static String SIP_SERVER_HOST = "59.110.217.175";
//	private final static int SIP_SERVER_PORT = 9170;

    //private GridView mGridView;
    private final INgnSipService mSipService;

    public ScreenSettings() {
        super(SCREEN_TYPE.SETTINGS_T, TAG);
        mEngine = NgnEngine.getInstance();
        //mConfigurationService = mEngine.getConfigurationService();
        mSipService = getEngine().getSipService();
    }

    private TextView txt_general;
    private TextView txt_identity;
    private TextView txt_network;
    private TextView txt_security;
    private TextView txt_codecs;
    private TextView txt_messages;
    private TextView txt_QoS;
    private TextView txt_NATT;
    private TextView txt_softbind;
    private Button login_button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_settings);

        txt_general = (TextView) findViewById(R.id.settings_general);
        txt_identity = (TextView) findViewById(R.id.settings_identity);
        txt_network = (TextView) findViewById(R.id.settings_network);
        txt_security = (TextView) findViewById(R.id.settings_security);
        txt_codecs = (TextView) findViewById(R.id.settings_codecs);
        txt_messages = (TextView) findViewById(R.id.settings_messaging);
        txt_QoS = (TextView) findViewById(R.id.settings_QoS);
        txt_NATT = (TextView) findViewById(R.id.settings_NATT);
        txt_softbind = (TextView) findViewById(R.id.settings_soft);
        login_button = (Button) findViewById(R.id.exit_login);

        txt_general.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//				Intent intent = new Intent(ScreenSettings.this, ScreenGeneral.class);
//				startActivity(intent);
                mScreenService.show(ScreenGeneral.class);
            }
        });

        txt_identity.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//				Intent intent = new Intent(ScreenSettings.this, ScreenIdentity.class);
//				startActivity(intent);
                mScreenService.show(ScreenIdentity.class);
            }
        });

        txt_messages.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//				Intent intent = new Intent(ScreenSettings.this, ScreenMessaging.class);
//				startActivity(intent);
                mScreenService.show(ScreenMessaging.class);
            }
        });

        txt_network.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//				Intent intent = new Intent(ScreenSettings.this, ScreenNetwork.class);
//				startActivity(intent);
                mScreenService.show(ScreenNetwork.class);
            }
        });

        txt_security.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//				Intent intent = new Intent(ScreenSettings.this, ScreenSecurity.class);
//				startActivity(intent);
                mScreenService.show(ScreenSecurity.class);
            }
        });

        txt_codecs.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//				Intent intent = new Intent(ScreenSettings.this, ScreenCodecs.class);
//				startActivity(intent);
                mScreenService.show(ScreenCodecs.class);
            }
        });

        txt_QoS.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//				Intent intent = new Intent(ScreenSettings.this, ScreenQoS.class);
//				startActivity(intent);
                mScreenService.show(ScreenQoS.class);
            }
        });

        txt_NATT.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mScreenService.show(ScreenNatt.class);
//				Intent intent = new Intent(ScreenSettings.this, ScreenNatt.class);
//				startActivity(intent);
            }
        });

        txt_softbind.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//				mScreenService.show(SoftBindActivity.class);
                if (LoginActivity.SIP_USERNAME == null)
                    Toast.makeText(ScreenSettings.this, "必须要登录才可使用该功能", Toast.LENGTH_SHORT).show();
                else {
                    Intent intent = new Intent(ScreenSettings.this, SoftBindActivity.class);
                    startActivity(intent);
                }
            }
        });

        login_button.setOnClickListener(new View.OnClickListener() {
                                            @Override
                                            public void onClick(View view) {
                                                mScreenService.show(LoginActivity.class);
                                            }
                                        }
        );

    }

}

